		<div class="ui-portlet">
			{{template wxes/_user_wxes}}
			<ol class="breadcrumb">
			  <li><a href="/users/index"><i class="fa fa-home"></i>&nbsp;&nbsp;135公众平台</a></li>
			  <li class="active">自动回复</li>
			  <li>公众号：{{$current_wxinfo['Wx']['name']}}</li>
			</ol> 
		</div>          
       <hr>
	<section style="border: 0px none; padding: 0px;margin-bottom:15px;">
		    <section class="135brush layout" style="white-space: normal;font-size: 14px; line-height: 25px; margin: 2px auto; padding: 10px 10px; border: 2px dashed #dedcde;max-width: 100%;">
		        <p style="margin: 0 0;">
		            授权135后，可在135配置自动回复。<a href="/wxes/edit/{{$wx_id}}" target="_blank">设置公众号资料</a>，确认是否开启了自动回复。
		        </p>
		    </section>
		    <section style="display: block; width: 0; height: 0; clear: both;"></section>
	</section>      
       
   <div>
       <a class="btn btn-primary showtooltip" href="{{$this->Html->url(array('action'=>'add'))}}?type=text"  title="新增自动回复文本"><i class="fa fa-plus"></i>&nbsp; <i class="fa fa-file-text-o"></i> 文本</a>
       <a class="btn btn-primary showtooltip" href="{{$this->Html->url(array('action'=>'add'))}}?type=news"  title="新增自动回复图文"><i class="fa fa-plus"></i>&nbsp; <i class="fa fa-th-list"></i> 图文</a>
       <a class="btn btn-primary showtooltip" href="{{$this->Html->url(array('action'=>'add'))}}?type=image"  title="新增自动回复图片"><i class="fa fa-plus"></i>&nbsp; <i class="fa fa-image"></i> 图片</a>
       <a class="btn btn-primary showtooltip" href="{{$this->Html->url(array('action'=>'add'))}}?type=voice"  title="新增自动回复语言"><i class="fa fa-plus"></i>&nbsp; <i class="fa fa-volume-up"></i> 语音</a>
       <a class="btn btn-primary showtooltip" href="{{$this->Html->url(array('action'=>'add'))}}?type=music"  title="新增自动回复音乐"><i class="fa fa-plus"></i>&nbsp; <i class="fa fa-music"></i> 音乐</a>
       <a class="btn btn-primary showtooltip" href="{{$this->Html->url(array('action'=>'add'))}}?type=video"  title="新增自动回复视频"><i class="fa fa-plus"></i>&nbsp; <i class="fa fa-video-camera"></i> 视频</a>		
   </div>
   <!-- <div class="alert alert-info"><strong>提示：</strong>在编辑器新增图文时，设置自动回复关键字会自动创建自动回复规则。</div> -->
  
   
   <div class="ui-portlet-header">
	      <span class="title">自动回复关键字列表</span>            
   </div>
   
	 <div style="margin:10px 0;">
   		<p><a href="javascript:void(0)" onclick="publishController.open_dialog('/wx_auto_replies/rules?word=subscribe',{title:'“关注自动回复”消息'});" class="btn btn-default">
	    	 	<i class="fa fa-list"></i> 查看关注自动回复规则
	    	 	</a>
	    	 	&nbsp;
	    	 	<a href="javascript:void(0)" onclick="publishController.open_dialog('/wx_auto_replies/rules?word=default',{title:'“默认自动回复”消息'});" class="btn btn-default">
	    	 	<i  class="fa fa-list"></i> 查看默认(未命中)自动回复规则
	    	 	</a>
	    	 	
	   	</p>
   </div>
   <ul class="nav nav-tabs">
  <li role="presentation" {{if empty($_REQUEST['type'])}} class="active" {{/if}}><a href="/wx_auto_replies/mine">全部</a></li>
  <li role="presentation" {{if $_REQUEST['type']=='text'}} class="active" {{/if}}><a href="/wx_auto_replies/mine?type=text">文本</a></li>
  <li role="presentation" {{if $_REQUEST['type']=='news'}} class="active" {{/if}}><a href="/wx_auto_replies/mine?type=news">图文</a></li>
  <li role="presentation" {{if $_REQUEST['type']=='image'}} class="active" {{/if}}><a href="/wx_auto_replies/mine?type=image">图片</a></li>
  <li role="presentation" {{if $_REQUEST['type']=='voice'}} class="active" {{/if}}><a href="/wx_auto_replies/mine?type=voice">语音</a></li>
  <li role="presentation" {{if $_REQUEST['type']=='music'}} class="active" {{/if}}><a href="/wx_auto_replies/mine?type=music">音乐</a></li>
  <li role="presentation" {{if $_REQUEST['type']=='video'}} class="active" {{/if}}><a href="/wx_auto_replies/mine?type=video">视频</a></li>
</ul>
<style>
	.col-md-4 {
		width: 33.3%;
	}
</style>
 <?php $msgtype_text = array('text'=>'文本','news'=>'图文','image'=>'图片','voice'=>'语音','music'=>'音乐','video'=>'视频',); ?>  
    		<div class="clearfix ui-portlet" style="margin-top:10px;" id="WxAutoReply-mine-list">
		       <div class="row">
		       {{loop $datalist $item}}
		       	<div class="col-md-4">
		       		<div class="appmsg article-msg clearfix">
			       		<div class="appmsg_content">
			       			{{if $item[0]['num'] == 1}}<small class="pull-right" style="color:#999;">{{$msgtype_text[ $item['WxAutoReply']['msg_type'] ]}}回复</small>{{/if}}
			       			<p>{{$item['WxAutoReply']['keyword']}}{{if $item[0]['num']>1}} &nbsp;&nbsp; <small>(共{{$item[0]['num']}}条)</small>{{/if}}</p>
			       			
			       			<div><small>其他回复词：<span style="color:red;">{{$similar_words[$item['WxAutoReply']['keyword']]}}</span>
			       			<a href="javascript:void(0)" onclick="publishController.open_dialog('{{$this->Html->url('/wx_similars/edit')}}?inajax=1&name={{$item['WxAutoReply']['keyword']}}',{title:'“{{$item['WxAutoReply']['keyword']}}”的近义词','selector':'#SimilarForm'});" 
				       			><i data-toggle="tooltip" data-placement="top" title="修改其他回复词" class="fa fa-edit"></i></a></small> 
				       		</div>
				       		<hr style="margin:5px;">
			       			<small>
			       			{{if $item[0]['num'] == 1}}
				       			{{if $item['WxAutoReply']['summary']}}
				       				<p style="white-space: pre-line;">{{$item['WxAutoReply']['summary']}}</p>
				       			{{elseif $item['WxAutoReply']['msg_type']=='music'}}
				       				<p>{{$item['WxAutoReply']['name']}}</p>
				       				<audio src="{{$item['WxAutoReply']['url']}}" controls ></audio>
				       			{{elseif $item['WxAutoReply']['msg_type']=='image'}}
				       				<img src="/wx_msgs/wechat_thumb?mid={{$item['WxAutoReply']['media_id']}}">
				       			{{/if}}
				       		{{/if}}
				       		</small>
			       		</div>
			       		
			       		{{if $_REQUEST['operate'] == 'select'}}
							<div class="appmsg_opr clearfix">
								<a href="javascript:void(0)" class="col-xs-12 choose-keyword" data-keyword="{{$item['WxAutoReply']['keyword']}}" ><i  class="glyphicon glyphicon-check"></i>选择</a>
							</div>
						{{else}}
						
				       		<div class="appmsg_opr clearfix">
				       		
				       		{{if $item[0]['num'] > 1}}
				       			<a href="javascript:void(0)" onclick="publishController.open_dialog('{{$this->Html->url('/wx_auto_replies/rules')}}?word={{$item['WxAutoReply']['keyword']}}',{title:'“{{$item['WxAutoReply']['keyword']}}”回复消息列表'});" class="col-xs-6" 
				       			><i data-toggle="tooltip" data-placement="top" 
				       			 title="回复消息列表" class="glyphicon glyphicon-list"></i></a>
				       			 
				       			 
				       			<a href="javascript:void(0)" data-url="{{$this->Html->url('/wx_auto_replies/delete_word')}}?word=$item['WxAutoReply']['keyword']" class="col-xs-6 delete-pop" data-container="body" 
				       			data-content="确定删除此自动回复？"><i data-toggle="tooltip" data-placement="top" 
				       			 title="{{__('Delete')}}" class="fa fa-trash"></i></a>
				       		{{else}}
				       			{{$this->Html->link('<i data-toggle="tooltip" target="_blank"  data-placement="top" title="'.__('Edit').'" class="fa fa-edit"></i>', array('controller'=>'wx_auto_replies','action' => 'edit', $item['WxAutoReply']['id']),array('class'=>'col-xs-6 opr-edit','data-id'=>$item['WxAutoReply']['id'],'escape'=>false))}}
			       				<a href="javascript:void(0)" data-url="{{$this->Html->url('/wx_auto_replies/delete/'.$item['WxAutoReply']['id'])}}" class="col-xs-6 delete-pop" data-container="body" 
			       			data-content="确定删除此素材？"><i data-toggle="tooltip" data-placement="top" 
			       			 title="{{__('Delete')}}" class="fa fa-trash"></i></a>
			       			
				       		{{/if}}
				       		
				       			
				       		</div>
				       	{{/if}}
		       		</div>
		       	</div>
		  		{{/loop}}
		    	</div>
	    		{{$page_navi}}
	    	</div>
	    	
	    	 <div>
	    	 	<hr/>
			     <p>  
			     <a class="btn btn-primary" href="{{$this->Html->url(array('action'=>'wechatAutoreply'))}}"><i class="fa fa-weixin"></i> 将在微信设置的自动回复规则同步到135</a>
			     &nbsp;
	    	 	<a href="/wx_auto_replies/clear" onclick="return confirm('是否确认清空所有在135设置的规则。注意，清空后将不可恢复');" class="btn btn-warning">
	    	 	<i  class="fa fa-trash"></i> 清空所有回复规则	</a>
			     </p>
			 </div>
			 
			 
			 
<tplsection>

	{{$this->Html->script(array(
	            'jquery/jquery.masonry.min.js',
	        ));
	}}
	
	<script>	
	$(function(){		 
		    var $container = $('#WxAutoReply-mine-list .row'); 
		    $container.imagesLoaded( function(){
		      $container.masonry({
		        itemSelector: '.col-md-4',
		        animate: true,
		        animationOptions: {
		            duration: 400,
		            easing: 'linear',
		            queue: false
		        }
		      });
		    });
	});
	
	</script>
</tplsection>